<template>
  <el-form inline size="middle">
    <el-row>
      <el-col>
        <el-form-item label="姓名">
          <el-input v-model="formData.name"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col>
        <el-form-item label="年龄">
          <el-input v-model="formData.age"></el-input>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col>
        <el-form-item label="爱好">
          <el-select v-model="formData.hobby" placeholder="请选择">
            <el-option v-for="item in fdata.hobbyArray"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>

  </el-form>
</template>

<script>
export default {
  name: "TestForm",
  props: ["fdata"],
  data() {
    return {
      formData: {
        id: "",
        name: "",
        age: "",
        hobby: "",
      }
    }
  },
  methods: {
    takeFormData() {
      return this.formData;
    },

    initForm(formProps) {
      this.formData.id = formProps.id;
      this.formData.name = formProps.name;
      this.formData.age = formProps.age;
    },
  },

  mounted() {
    this.initForm(this.fdata);
  }

}
</script>

<style scoped>

</style>